//Accepted
#include <cstdio>
int main(){
	//freopen("in.txt","r",stdin);
	int a[50], n, sum, r, i, t=1;
	scanf("%d", &n);
	while(n){
		r=sum=0;
		for(i=0;i<n;++i){
			scanf("%d", &a[i]);
			sum+=a[i];
		}
		sum/=n;
		for(i=0;i<n;++i)
			if(a[i]>sum)r+=a[i]-sum;
		
		
		printf("Set #%d\nThe minimum number of moves is %d.\n\n", t++, r);
		
		scanf("%d", &n);
	}
	return 0;
}
